package lib

import (
	"algorithms/ds"
)

func init() {
	Probs = append(Probs, Problem{
		Num:         104,
		Discription: "二叉树的最大深度",
		Level:       1,
		Labels: map[string]int{
			"递归":  1,
			"二叉树": 1,
		},
	})
}

func MaxDepth(root *ds.TreeNode) int {
	if root == nil {
		return 0
	}

	return max(MaxDepth(root.Left), MaxDepth(root.Right)) + 1
}
